package com.cxhc.system.service.app.impl;

import java.util.List;

import com.cxhc.common.utils.StringUtils;
import com.cxhc.system.domain.app.RpSecInvestigation;
import com.cxhc.system.mapper.app.RpSecInvestigationMapper;
import com.cxhc.system.service.app.IRpSecInvestigationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 治安检查Service业务层处理
 * 
 * @author Dhq
 * @date 2024-08-15
 */
@Service
public class RpSecInvestigationServiceImpl implements IRpSecInvestigationService
{
    @Autowired
    private RpSecInvestigationMapper rpSecInvestigationMapper;

    /**
     * 查询治安检查
     * 
     * @param ID 治安检查主键
     * @return 治安检查
     */
    @Override
    public RpSecInvestigation selectRpSecInvestigationByID(Long ID)
    {

        RpSecInvestigation rpSecInvestigation = rpSecInvestigationMapper.selectRpSecInvestigationByID(ID);
        if (!StringUtils.isEmpty(rpSecInvestigation.getPhoto())){
            rpSecInvestigation.setPhoto(rpSecInvestigation.getPhoto().replaceAll("http://img.wq-info.com","https://huanchuang-imgs.wq-info.com"));
        }
        if (!StringUtils.isEmpty(rpSecInvestigation.getCompletePhoto())){
            rpSecInvestigation.setCompletePhoto(rpSecInvestigation.getCompletePhoto().replaceAll("http://img.wq-info.com","https://huanchuang-imgs.wq-info.com"));
        }
        return rpSecInvestigation;
    }

    /**
     * 查询治安检查列表
     * 
     * @param rpSecInvestigation 治安检查
     * @return 治安检查
     */
    @Override
    public List<RpSecInvestigation> selectRpSecInvestigationList(RpSecInvestigation rpSecInvestigation)
    {

        List<RpSecInvestigation> rpSecInvestigations = rpSecInvestigationMapper.selectRpSecInvestigationList(rpSecInvestigation);
        for (RpSecInvestigation secInvestigation : rpSecInvestigations) {
            if (!StringUtils.isEmpty(secInvestigation.getPhoto())){
                secInvestigation.setPhoto(secInvestigation.getPhoto().replaceAll("http://img.wq-info.com","https://huanchuang-imgs.wq-info.com"));
            }
            if (!StringUtils.isEmpty(secInvestigation.getCompletePhoto())){
                secInvestigation.setCompletePhoto(secInvestigation.getCompletePhoto().replaceAll("http://img.wq-info.com","https://huanchuang-imgs.wq-info.com"));
            }
        }
        return rpSecInvestigations;
    }

    /**
     * 新增治安检查
     * 
     * @param rpSecInvestigation 治安检查
     * @return 结果
     */
    @Override
    public int insertRpSecInvestigation(RpSecInvestigation rpSecInvestigation)
    {
        return rpSecInvestigationMapper.insertRpSecInvestigation(rpSecInvestigation);
    }

    /**
     * 修改治安检查
     * 
     * @param rpSecInvestigation 治安检查
     * @return 结果
     */
    @Override
    public int updateRpSecInvestigation(RpSecInvestigation rpSecInvestigation)
    {
        return rpSecInvestigationMapper.updateRpSecInvestigation(rpSecInvestigation);
    }

    /**
     * 批量删除治安检查
     * 
     * @param IDs 需要删除的治安检查主键
     * @return 结果
     */
    @Override
    public int deleteRpSecInvestigationByIDs(Long[] IDs)
    {
        return rpSecInvestigationMapper.deleteRpSecInvestigationByIDs(IDs);
    }

    /**
     * 删除治安检查信息
     * 
     * @param ID 治安检查主键
     * @return 结果
     */
    @Override
    public int deleteRpSecInvestigationByID(Long ID)
    {
        return rpSecInvestigationMapper.deleteRpSecInvestigationByID(ID);
    }
}
